import request from '@/utils/request'
// 获取 WAHA 会话列表
export function getWahaSessionList(args) {
  return request({
    url: `/chatbot/api/waha-session/${args && ('?' + args) || ''}`,
    method: 'get'
  })
}
// 创建 WAHA 会话
export function createWahaSession(data) {
  return request({
    url: '/chatbot/api/waha-session/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}
// 获取 WAHA 会话详情
export function getWahaSessionDetail(id) {
  return request({
    url: `/chatbot/api/waha-session/${id}/`,
    method: 'get'
  })
}
// 更新 WAHA 会话
export function updateWahaSession(id, data) {
  return request({
    url: `/chatbot/api/waha-session/${id}/`,
    headers: { 'content-type': 'application/json' },
    method: 'put',
    data: data
  })
}
// 删除 WAHA 会话
export function deleteWahaSession(id) {
  return request({
    url: `/chatbot/api/waha-session/${id}/`,
    method: 'delete'
  })
}
// 启动 WAHA 会话
export function startWahaSession(id) {
  return request({
    url: `/chatbot/api/waha-session/${id}/start/`,
    method: 'post'
  })
}
// 停止 WAHA 会话
export function stopWahaSession(id) {
  return request({
    url: `/chatbot/api/waha-session/${id}/stop/`,
    method: 'post'
  })
}
// 获取会话状态
export function getWahaSessionStatus(id) {
  return request({
    url: `/chatbot/api/waha-session/${id}/status/`,
    method: 'get'
  })
}
// 批量启动会话
export function batchStartWahaSessions(ids) {
  return request({
    url: '/chatbot/api/waha-session/batch-start/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: { ids: ids }
  })
}
// 批量停止会话
export function batchStopWahaSessions(ids) {
  return request({
    url: '/chatbot/api/waha-session/batch-stop/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: { ids: ids }
  })
}
// 同步会话状态
export function syncWahaSessionStatus(id) {
  return request({
    url: `/chatbot/api/waha-session/${id}/sync-status/`,
    method: 'post'
  })
}
